/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package projetlif13.model.puissance4;

import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import projetlif13.model.Board;
import projetlif13.model.HumanPlayer;
import projetlif13.model.Move;
import projetlif13.scene.GameScene;

/**
 *
 * @author theo
 */
public class HPlayerP4 extends HumanPlayer {

    public HPlayerP4(String name){
        super(name);
    }
    
    @Override
    public Move getMove(Board _board) {
        boolean canreturn = false;
        Move m = null;
        while (!canreturn) {
            HumanPlayer.canPlay = true;
            while (GameScene.cmde.equals("")) { //on lit la comande du GameScene
                try {
                    Thread.sleep(100);
                } catch (InterruptedException ex) {
                    Logger.getLogger(HPlayerP4.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            System.out.println(GameScene.cmde);
            int x = Integer.parseInt(GameScene.cmde);
            GameScene.cmde = "";
            m = new P4Move(x, 0);
            canreturn = GameScene.gv.getGame().moveAvailable(m);
        }
        return m;
    }
}
